import time
import calendar

# 获取时间戳
stamp = time.time()
print(time.ctime())
# 转换为时间元组(转换基础格式)
localtime = time.localtime(stamp)
print(localtime)
# 转换为格式化日期
utcTime = time.asctime(localtime)
print(utcTime)
# 自定义格式
formattime = time.strftime("%Y-%m-%d %H:%M:%S", localtime)
print(formattime)
# 获取日历
print(calendar.month(2024, 4))

# 函数的值or引用传递
def changeParameters(val):
    val[0] = "djasldj"

list = [1,2,3,4]
changeParameters(list); print(list)

# 函数的不定长参数通过指针实现
def function1(val1, *valn):
    print(val1)
    for v in valn:
        print(v)

function1(1,2,3,4)

# lambda表达式
getSum = lambda val1, val2 : val1 + val2
print(getSum(100, 999))

print(dir()) # 打印所有引入的模块名
print(globals().keys()) # 打印当前定义的所有全局变量
print(locals().keys()) # 打印当前定义的所有局部变量